import 'package:flutter/material.dart';

class AspectRatioDem extends StatelessWidget {
  const AspectRatioDem({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('AspectRatioDem'),
      ),
      body: Container(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Container(
              width: 300.0,
              child: AspectRatio(
                // 最大边撑开最大，最小边按比例缩放,如果有定值，另一个等比缩放;
                aspectRatio: 16.0 / 9.0,
                child: Container(
                  color: Color.fromRGBO(30, 154, 25, 1.0),
                  child: Text('data'),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
